from socket import *


tcp_socket = socket(AF_INET, SOCK_STREAM)
tcp_socket.bind(("0.0.0.0", 8888))
tcp_socket.listen()

print("Waiting for a connect... ...")
while True:
    conn, addr = tcp_socket.accept()
    print("Connect has been done...", addr)

    while True:
        data = conn.recv(1024)
        print("over:", data.decode())
        if not data or data.decode() == "##":
            break
        conn.send(b"Thanks")
    conn.close()

tcp_socket.close()
